package net.wofly.right.service;

import java.util.List;

import net.wofly.right.domain.Role;
import net.wofly.right.domain.User;
import net.wofly.right.domain.UserRole;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

public interface IUserRoleService {

	/**
	 * 增加或修改
	 * 
	 * @param entity
	 * @return
	 */
	UserRole save(UserRole entity);

	/**
	 * 删除
	 * 
	 * @param entity
	 * @return
	 */
	void delete(UserRole entity);

	/**
	 * 根据主键ID删除
	 * 
	 * @param key
	 * @return
	 */
	void delete(String key);

	/**
	 * 根据主键查询
	 * 
	 * @param key
	 * @return
	 */
	UserRole findOne(String key);
	
	List<UserRole> save(List<UserRole> entityList) ;
	
	List<UserRole> findByUserID(String userID);

	List<UserRole> findByRoleID(String roleID);

	List<User> findUsersByRoleID(String roleID);
	
	List<User> findUsersByRoleIDs(List<String> roleIDs);
	
	List<Role> findRolesByUserID(String userID);

	/**
	 * 根据角色ID分页查询用户列表
	 *
	 * @param roleID
	 * @param pageable
	 * @return
	 */
	Page<User> findPageByRoleID(String roleID, Pageable pageable);
}
